//二叉树测试

#include <iostream>
#include "binarytree.h"

using namespace std;

void print(char c)
{
    cout << c;
}

int main()
{
    //建立二叉树
    //         - 
    //    *        c
    //  a   b
    //BiTree<char> T = new BiTNode<char>{
    //    '-',
    //    new BiTNode<char>{
    //        '*',
    //       new BiTNode<char>{'a', nullptr, nullptr},
    //        new BiTNode<char>{'b', nullptr, nullptr},
    //    },
    //    new BiTNode<char>{'c', nullptr, nullptr},
    //};
    BiTree<char> T;
    cout << "Creat binary tree in perorder:";
    CreatBinaryTree(T);

    //定义 Lambda 函数
    auto print = [](char c){ cout << c; };

    //先序遍历
    cout << "\nPreOrder:";
    PreOrder(T, print);
    //中序遍历
    cout << "\nInOrder:";
    InOrder(T, print);
    //后序遍历
    cout << "\nPostOrder:";
    PostOrder(T, print);
    cout << endl;

    //二叉树中结点数、叶子结点数、深度
    cout << "NodeCount: " << NodeCount(T) << endl;
    cout << "LeafCount: " << LeafCount(T) << endl;
    cout << "Depth: " << Depth(T) << endl;

    //打印二叉树
    PrintBinaryTree(T, 0);

    return 0;
}